The constructor for a React component is called before it is mounted.
When implementing the constructor for a React.Component subclass, you should call super(props) before any other statement. Otherwise, this.props will be undefined in the constructor, which can lead to bugs.
Initialising local state by assigning an object to this.state.
Binding event handler methods to an instance.
You should not call setState() in the constructor(). Constructor is the only place where you should assign this.state directly. In all other methods, you need to use this.setState() instead.
If you don’t initialise the state and you don’t bind methods, you don’t need to implement a constructor for your React component.
Avoid introducing any side effects or subscriptions in the constructor. For those use cases, use componentDidMount() instead.